Skip to content

feat: convert datetime values to RFC 3339 in WebDAV search literals#358

Merged
bigcat88 merged 2 commits into
mainfrom
feat/dav/support-python-datetime
May 1, 2025
Merged

feat: convert datetime values to RFC 3339 in WebDAV search literals#358
bigcat88 merged 2 commits into
mainfrom
feat/dav/support-python-datetime

Conversation

@bigcat88

@bigcat88 bigcat88 commented May 1, 2025

Copy link
Copy Markdown
Contributor

Fixes #347 .

This PR fixes incorrect handling of datetime and date objects in WebDAV find() queries. Previously, passing a datetime resulted in an invalid string format like 2025-03-10 12:34:56.123456, causing Nextcloud to misinterpret the value in <d:literal>.

Changes made:

  • Added _dav_literal() helper to format datetime values as RFC 3339 strings (2025-03-10T12:34:56Z)
  • Updated build_search_req() to use this helper when generating <d:literal> values

This ensures proper comparison logic for operators like "gt" and "lt" when filtering by last_modified or other time-based properties.

Fixes issues where files were incorrectly included or excluded due to string-based comparison.

Signed-off-by: bigcat88 <bigcat88@icloud.com>
@codecov

codecov Bot commented May 1, 2025

Copy link
Copy Markdown

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 95.14%. Comparing base (ebce575) to head (a6828a7).
Report is 2 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #358   +/-   ##
=======================================
  Coverage   95.13%   95.14%           
=======================================
  Files          45       45           
  Lines        5325     5333    +8     
=======================================
+ Hits         5066     5074    +8     
  Misses        259      259           
Files with missing lines Coverage Δ
nc_py_api/files/_files.py 98.65% <100.00%> (+0.05%) ⬆️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Signed-off-by: bigcat88 <bigcat88@icloud.com>
@bigcat88 bigcat88 merged commit f0ec9d0 into main May 1, 2025
13 checks passed
@bigcat88 bigcat88 deleted the feat/dav/support-python-datetime branch May 1, 2025 07:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Finding files by modified date returns incorrect results

1 participant